﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using WMSADL.SY;
using WMSAML.SY;

namespace WMSABL.SY
{
    public class TPermissions_BLL
    {
        TPermissions_DAL dal = new TPermissions_DAL();
        /// <summary>
        /// Add
        /// </summary>
        public int Add(TPermissions_Entity entity)
        {
            return dal.Add(entity);
        }

        /// <summary>
        /// Delete
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TPermissions_Entity entity)
        {
            return dal.Update(entity);
        }

        /// <summary>
        /// ByID
        /// </summary>
        public bool ExistsByID(int id)
        {
            return dal.ExistsByID(id);
        }
        /// <summary>
        /// Bytype
        /// </summary>
        public bool ExistsByType(int type)
        {
            return dal.ExistsByType(type);
        }

        /// <summary>
        /// 
        /// </summary>
        public TPermissions_Entity GetEntityByMidType(int moudleid, int type)
        {
            return dal.GetEntityByID(moudleid, type);
        }

        /// <summary>
        /// 
        /// </summary>
        public TPermissions_Entity GetEntityByType(int moudleid, string type)
        {
            int permissionsType = 0;
            switch (type)
            {
                case ("浏览"):
                    permissionsType = 1;
                    break;
                case ("新增"):
                    permissionsType = 2;
                    break;
                case ("编辑"):
                    permissionsType = 3;
                    break;
                case ("删除"):
                    permissionsType = 4;
                    break;
                case ("查询"):
                    permissionsType = 5;
                    break;
                case ("查看"):
                    permissionsType = 6;
                    break;
                case ("移动"):
                    permissionsType = 7;
                    break;
                case ("报表打印"):
                    permissionsType = 10;
                    break;
                case ("授权"):
                    permissionsType = 8;
                    break;
                case ("审核"):
                    permissionsType = 9;
                    break;
                case ("报表导出"):
                    permissionsType = 11;
                    break;
                case ("系统初始化"):
                    permissionsType = 12;
                    break;
                case ("数据还原/备份"):
                    permissionsType = 13;
                    break;
                default:
                    break;
            }
            return dal.GetEntityByID(moudleid, permissionsType);
        }


    }
}

